<template>
	<view class="page">
		<view class="content">
			 <view class="icon" >
				  <image  :src="iconUrl?iconUrl:'../../../static/img/tabbar/默认头像.png'" style="width: 50px;height: 50px;border-radius: 180px;"></image>
				  <view v-if="title == '未登录'" @tap="clearLogin('/pages/loginOnlyPhone/loginOnlyPhone')">{{title}}</view>
				   <view v-else="title == '未登录'">{{title}}</view>
			 </view>
			
			<!-- 统计 -->
			<view class="count">
				<view class="cell"> {{countList[0]}} <label style="color: #AAAAAA;">分享了您</label> </view>
				<view class="cell"> {{countList[1]}} <label style="color: #AAAAAA;">收藏了您</label> </view>
				<view class="cell"> {{countList[2]}} <label style="color: #AAAAAA;">举报了您</label> </view>
			</view>
			<!-- 我的订单 -->
			<view class="orders">
				
				<view class="sorts">
						<view class="sorts0"> 
							<view  @tap="gotoFeeds('/pages/tabbar/my/myOrder/myOrder')">
								<image src='../../../static/home/采购.png' style="width: 40px;height: 40px;"></image>
							</view>
							<view  @tap="gotoFeeds('/pages/tabbar/my/myOrder/myOrder')">
								<label class="icon-bill">我的采购({{countList[3]}})</label>
							</view>
						</view>
						 
						<view class="sorts0"> 
							<view  @tap="gotoFeeds('/pages/tabbar/my/myShop/myShop')">
								<image src='../../../static/home/货源.png' style="width: 40px;height: 40px;"></image>
							</view>
							<view  @tap="gotoFeeds('/pages/tabbar/my/myShop/myShop')">
								<label class="icon-car">我的货源({{countList[4]}})</label>
							</view>
						</view>
						<view class="sorts0"> 
							<view @tap="gotoFeeds('/pages/tabbar/my/myCall/myCall')">
								<image src='../../../static/home/dianhua.png' style="width: 40px;height: 40px;"></image>
							</view>
							<view @tap="gotoFeeds('/pages/tabbar/my/myCall/myCall')">
								<label class="icon-money">拨打记录({{countList[5]}})</label>
							</view>
						</view>
						<view class="sorts0"> 
							<view  @tap="gotoFeeds('/pages/tabbar/my/myCar/myCar')">
								<image src='../../../static/img/tabbar/Profile.png' style="width: 40px;height: 40px;"></image>
							</view>
							<view @tap="gotoFeeds('/pages/tabbar/my/myCar/myCar')">
								<label class="icon-list">用车记录({{countList[6]}})</label>
							</view>
						</view>
				</view>
		 
			
			</view>
		<view class="orders2">
			<view class="sorts2">
					 <view class="sortsIcon"  @tap="gotoFeeds('/pages/tabbar/my/limitTimeInput/limitTimeInput')">
					 	<image src='../../../static/home/shop.png'></image>
					 </view>
					 <view class="sortsTxt" @tap="gotoFeeds('/pages/tabbar/my/limitTimeInput/limitTimeInput')">
					 	<label class="icon-list">每日沟通上限设置(默认6次)</label>
					 </view>
					 <view class="sortsNext"  @tap="gotoFeeds('/pages/tabbar/my/limitTimeInput/limitTimeInput')">
					 	<image src='../../../static/home/next.png'></image>
					 </view>
			</view>
		</view>
		
		<view class="orders2">
			<view class="sorts2">
					 <view class="sortsIcon"  @tap="gotoFeeds('/pages/loginOnlyPhone/regist')">
					 	<image src='../../../static/home/caigou.png'></image>
					 </view>
					 <view class="sortsTxt" @tap="gotoFeeds('/pages/loginOnlyPhone/regist')">
					 	<label class="icon-list">手机号修改</label>
					 </view>
					 <view class="sortsNext"  @tap="gotoFeeds('/pages/loginOnlyPhone/regist')">
					 	<image src='../../../static/home/next.png'></image>
					 </view>
			</view>
		</view>
 
		<view class="orders3">
			<view class="sorts2">
					 <view class="sortsIcon"  @tap="call()">
					 	<image src='../../../static/img/tabbar/find.png'></image>
					 </view>
					 <view class="sortsTxt" @tap="call()">
					 	<label class="icon-list">投诉与反馈</label>
					 </view>
					 <view class="sortsNext"  @tap="call()">
					 	<image src='../../../static/home/next.png'></image>
					 </view>
			</view>
		</view>
		
		
		<view class="orders2">
			<view class="sorts2">
					 <view class="sortsIcon"  @tap="clearLogin('/pages/loginOnlyPhone/loginOnlyPhone')">
					 	<image src='../../../static/home/团队2.png'></image>
					 </view>
					 <view class="sortsTxt" @tap="clearLogin('/pages/loginOnlyPhone/loginOnlyPhone')">
					 	<label class="icon-list">{{title =='未登录' ? '立即登录' : '退出登录'}}</label>
					 </view>
					 <view class="sortsNext"  @tap="clearLogin('/pages/loginOnlyPhone/loginOnlyPhone')">
					 	<image src='../../../static/home/next.png'></image>
					 </view>
			</view>
		</view>
		</view>
	</view>
 
</template>

<script>
	
	import utils from '@/utils/requset.js'
	import operate from '@/common/operate.js'
	import app from '@/App.vue'
	export default {
		data() {
			return {
				countList:[0,0,0,0,0,0,0,0,0],
				iconUrl:uni.getStorageSync("userInfo").iconUrl,
				title: uni.getStorageSync("userInfo").nickName ? uni.getStorageSync("userInfo").nickName:'未登录',
				newsList:[
				
				] 
			}
		},
	 
		onLoad() {
			app.navTitle();
			 
			 
		},
		onShow() {
			app.navTitle();
			let userId = uni.getStorageSync("userInfo").id;
			if(userId){
				this.getNotice(userId);
			}else{
				
			}
		},
		methods: {
			call(){
				uni.makePhoneCall({
					phoneNumber:18438610533
				})
			},
			
			gotoFeeds(url) {
				if(uni.getStorageSync("userInfo").id){
					 console.log(url)
					 if (!url) return;
					 uni.navigateTo({
					 	url
					 });
				}else{
					uni.navigateTo({
						url: '/pages/loginOnlyPhone/loginOnlyPhone'
					})
				}
				 
			},
				clearLogin(url){
					if(uni.getStorageSync("userInfo").id){
						uni.setStorageSync("userInfo",{})
					}else{
						 this.gotoFeeds(url)
					}
				},
				getNotice(userId){
					// 请求参数
					var header = {},
						data = {
							pubUserIdTarget:userId
						},
						url = "/purchase/shopOrOrderMyLike/list", 
						method = "POST";
					if (method) {
						method = method.toUpperCase(); 
						if (method == "POST") {
							header = {
							   'Content-Type': "application/json"
							};
						} else {
							header = {
								'Content-Type': "application/json"
							};
						}	
					}
								 
					 uni.request({
						url: operate.api + url,		
						data: data,
						method: method,
						header: header,
						success: (res) => {
							console.log(res)
							if(res.statusCode && res.statusCode ==200){
								 
								if(res.data.data){
									 this.countList = res.data.data;
									
								} 
							}else{
								console.log("数据状态码！=200")
							}
							
						},fail(res2) {
							 
						},complete() {
							 
						}
					})
				},
				
				

		}
	}
</script>

<style  >
	.page{
		width: 100%;
	 
		font-size: 13px;
		font-weight: 400;
		letter-spacing: 0px;
		line-height: 20px;
	}
	.icon{
		padding: 20px;
		background-color: #fff;
	}
	.wrapper {
			position: absolute;
			top: 0;
			bottom: 0;
			width: 100%;
			background-color: #F4F4F4;
	}


	.content {
		text-align: center;
		height: 100%;
		background-color: #eee;
	}
	.count {
			display: flex;
			height: 120rpx;
			text-align: center;
			border-radius: 4rpx;
			background-color: #fff;
			position: relative;
			padding-bottom:10px;
	}
	.count label{
		display: block;
		font-size: 24rpx;
	}
	.cell {
		
		flex: 1;
		padding-top: 10rpx;
		font-size: 20px;
		color: #333;
	}
	.orders {
			margin: 20rpx 0rpx 20rpx 0rpx;
			background-color: #fff;
			border-radius: 4rpx; 
	}
	.orders2 {
			margin: 10rpx 0rpx 10rpx 0rpx;
			background-color: #fff;
			border-radius: 4rpx; 
	}
	.orders3 {
			margin: 10rpx 0rpx 0rpx 0rpx;
			background-color: #fff;
			border-radius: 4rpx; 
	}
	.title {
		padding-left: 20rpx;
		font-size: 30rpx;
		color: #333;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid #eee;
		margin-top: -30rpx;
	}
			
	.sorts {
		padding-top: 30rpx;
		text-align: center;
		display: flex;
		border-radius: 5px 5px 5px 5px;
		height: 80px;
	 
	}
	
	.sorts0{
		 flex: 1;
		 flex-direction: column; 
		 align-items: center;	
	}
		
	.sortsIcon{
		 flex: 1;	
		 line-height: 80px;
	}
	.sortsNext{
		flex: 1;
		line-height: 70px;
	}
	.sortsNext image{
		width: 30px;
		height: 30px;
		margin-top: 15px;
	}
	
	.sortsTxt{
		 flex: 3;	
		 line-height: 60px;
		 text-align: left;
	}
	.sortsIcon image{
		width: 40px;
		height: 40px;
		margin-top: 10px;
	}
	
	.sorts2 {
		text-align: center;
		display: flex;
		border-radius: 5px 5px 5px 5px;
		height: 60px;
	}
	 
</style>
